Merge pull request #179 from ms32035/master

Added to_i cast fixing String to number comparison error

Andrew Cantino 10 ans auparavant
Parent
Commettre
0a557332f6
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. 2 2
      db/migrate/20131223032112_switch_to_json_serialization.rb

+ 2 - 2
db/migrate/20131223032112_switch_to_json_serialization.rb

@@ -37,8 +37,8 @@ class SwitchToJsonSerialization < ActiveRecord::Migration
37 37
   end
38 38
 
39 39
   def data_exists?
40
-    events = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("events")}").first.first
41
-    agents = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("agents")}").first.first
40
+    events = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("events")}").first.first.to_i
41
+    agents = ActiveRecord::Base.connection.select_rows("SELECT count(*) FROM #{ActiveRecord::Base.connection.quote_table_name("agents")}").first.first.to_i
42 42
     agents + events > 0
43 43
   end
44 44